<!--<!DOCTYPE html>-->
<!--<html>-->

<!--<head>-->
<!--    <meta charset="utf-8">-->
<!--    <title>列表</title>-->
<!--    <link rel="stylesheet" href="../static/css/styles.css" />-->
<!--    <link rel="stylesheet" href="../static/css/font-awesome-4.7.0/css/font-awesome.min.css" />-->
<!--    <script src="../static/js/jquery.min.js" type="text/javascript"></script>-->
<!--</head>-->

<!--<body>-->
<!--&lt;!&ndash;    <script>&ndash;&gt;-->
<!--&lt;!&ndash;        function delcfm(p) {&ndash;&gt;-->
<!--&lt;!&ndash;            var r = confirm("确认删除该信息？");&ndash;&gt;-->
<!--&lt;!&ndash;            if (r == true) {&ndash;&gt;-->

<!--&lt;!&ndash;                var sno = p.parentNode.parentNode.children[0].innerHTML;&ndash;&gt;-->
<!--&lt;!&ndash;                var s = parseInt(p.parentNode.parentNode.children[11].innerHTML);&ndash;&gt;-->
<!--&lt;!&ndash;                if (s == 0) {&ndash;&gt;-->
<!--&lt;!&ndash;                    var xml = new XMLHttpRequest();&ndash;&gt;-->
<!--&lt;!&ndash;                    xml.open("get", "http://127.0.0.1:8080/delecour/" + sno, true);&ndash;&gt;-->
<!--&lt;!&ndash;                    // xml.onreadystatechange = function () {&ndash;&gt;-->
<!--&lt;!&ndash;                    //&ndash;&gt;-->
<!--&lt;!&ndash;                    // };&ndash;&gt;-->
<!--&lt;!&ndash;                    xml.send();&ndash;&gt;-->
<!--&lt;!&ndash;                    // xml.send("callback=functionName");&ndash;&gt;-->
<!--&lt;!&ndash;                    alert("删除成功");&ndash;&gt;-->
<!--&lt;!&ndash;                    window.location.href = '{{url_for('courselist')}}';&ndash;&gt;-->
<!--&lt;!&ndash;                } else alert("不能删除");&ndash;&gt;-->
<!--&lt;!&ndash;            } else&ndash;&gt;-->
<!--&lt;!&ndash;                alert("信息未删除");&ndash;&gt;-->
<!--&lt;!&ndash;        }&ndash;&gt;-->
<!--&lt;!&ndash;        var page = 1;&ndash;&gt;-->
<!--&lt;!&ndash;         var tabl = document.getElementById("abcde");&ndash;&gt;-->
<!--&lt;!&ndash;         alert(tabl);&ndash;&gt;-->
<!--&lt;!&ndash;        var maxo = 10;&ndash;&gt;-->
<!--&lt;!&ndash;        for (var i = 0; i < (tabl.rows.length - 1); i++) {&ndash;&gt;-->
<!--&lt;!&ndash;            tabl.rows[i + 1].style.display = 'none';&ndash;&gt;-->
<!--&lt;!&ndash;        }&ndash;&gt;-->

<!--&lt;!&ndash;        for (var i = 0; i < maxo; i++)&ndash;&gt;-->
<!--&lt;!&ndash;            tabl.rows[i + 1].style.display = "table-row";&ndash;&gt;-->

<!--&lt;!&ndash;        function vanish(num) {&ndash;&gt;-->
<!--&lt;!&ndash;            var limt = num * maxo;&ndash;&gt;-->
<!--&lt;!&ndash;            for (var i = 0; i < (tabl.rows.length - 1); i++) {&ndash;&gt;-->
<!--&lt;!&ndash;                tabl.rows[i + 1].style.display = 'none';&ndash;&gt;-->
<!--&lt;!&ndash;            }&ndash;&gt;-->

<!--&lt;!&ndash;            if (limt > (tabl.rows.length - 1))&ndash;&gt;-->
<!--&lt;!&ndash;                limt = (tabl.rows.length - 1);&ndash;&gt;-->
<!--&lt;!&ndash;            for (var i = (num - 1) * maxo; i < limt; i++)&ndash;&gt;-->
<!--&lt;!&ndash;                tabl.rows[i + 1].style.display = "table-row";&ndash;&gt;-->
<!--&lt;!&ndash;        }&ndash;&gt;-->

<!--&lt;!&ndash;        function first(id) {&ndash;&gt;-->
<!--&lt;!&ndash;            alert(1);&ndash;&gt;-->
<!--&lt;!&ndash;            page = 1;&ndash;&gt;-->
<!--&lt;!&ndash;            vanish(page);&ndash;&gt;-->
<!--&lt;!&ndash;            id.parentNode.children[4].value = page;&ndash;&gt;-->
<!--&lt;!&ndash;        }&ndash;&gt;-->

<!--&lt;!&ndash;        function last(id) {&ndash;&gt;-->
<!--&lt;!&ndash;            var maxsu = 0;&ndash;&gt;-->
<!--&lt;!&ndash;            if ((tabl.rows.length - 1) % maxo == 0)&ndash;&gt;-->
<!--&lt;!&ndash;                maxsu = Math.floor((tabl.rows.length - 1) / maxo);&ndash;&gt;-->
<!--&lt;!&ndash;            else maxsu = Math.floor((tabl.rows.length - 1) / maxo) + 1;&ndash;&gt;-->
<!--&lt;!&ndash;            page = maxsu;&ndash;&gt;-->
<!--&lt;!&ndash;            vanish(page);&ndash;&gt;-->
<!--&lt;!&ndash;            id.parentNode.children[4].value = page;&ndash;&gt;-->
<!--&lt;!&ndash;        }&ndash;&gt;-->

<!--&lt;!&ndash;        function prev(id) {&ndash;&gt;-->
<!--&lt;!&ndash;            if (page > 1)&ndash;&gt;-->
<!--&lt;!&ndash;                page&#45;&#45;;&ndash;&gt;-->
<!--&lt;!&ndash;            vanish(page);&ndash;&gt;-->
<!--&lt;!&ndash;            id.parentNode.children[4].value = page;&ndash;&gt;-->
<!--&lt;!&ndash;        }&ndash;&gt;-->

<!--&lt;!&ndash;        function next(id) {&ndash;&gt;-->
<!--&lt;!&ndash;            var maxsu = 0;&ndash;&gt;-->
<!--&lt;!&ndash;            if ((tabl.rows.length - 1) % maxo == 0)&ndash;&gt;-->
<!--&lt;!&ndash;                maxsu = Math.floor((tabl.rows.length - 1) / maxo);&ndash;&gt;-->
<!--&lt;!&ndash;            else maxsu = Math.floor((tabl.rows.length - 1) / maxo) + 1;&ndash;&gt;-->
<!--&lt;!&ndash;            if (page < maxsu)&ndash;&gt;-->
<!--&lt;!&ndash;                page++;&ndash;&gt;-->
<!--&lt;!&ndash;            id.parentNode.children[4].value = page;&ndash;&gt;-->
<!--&lt;!&ndash;            vanish(page);&ndash;&gt;-->
<!--&lt;!&ndash;        }&ndash;&gt;-->

<!--&lt;!&ndash;        function change(id) {&ndash;&gt;-->
<!--&lt;!&ndash;            if ((tabl.rows.length - 1) % maxo == 0)&ndash;&gt;-->
<!--&lt;!&ndash;                maxsu = Math.floor((tabl.rows.length - 1) / maxo);&ndash;&gt;-->
<!--&lt;!&ndash;            else maxsu = Math.floor((tabl.rows.length - 1) / maxo) + 1;&ndash;&gt;-->
<!--&lt;!&ndash;            page = id.parentNode.children[4].value;&ndash;&gt;-->
<!--&lt;!&ndash;            if (page > maxsu)&ndash;&gt;-->
<!--&lt;!&ndash;                page = maxsu;&ndash;&gt;-->
<!--&lt;!&ndash;            if (page < 0)&ndash;&gt;-->
<!--&lt;!&ndash;                page = 1;&ndash;&gt;-->
<!--&lt;!&ndash;            id.parentNode.children[4].value = page;&ndash;&gt;-->
<!--&lt;!&ndash;            vanish(page);&ndash;&gt;-->
<!--&lt;!&ndash;        }&ndash;&gt;-->
<!--&lt;!&ndash;    </script>&ndash;&gt;-->
<!--    <div class="condition">-->
<!--        <form action="{{ url_for('courselistse') }}" method="post" enctype="multipart/form-data">-->
<!--            课程编号<input type="text" name="cid"> 课程名称：-->
<!--            <input type="text" name="cname">上课时间：-->
<!--            <input type="text" name="classtime">-->

<!--            <button>-->
<!--				<i class="fa fa-search" type="submit"></i>-->
<!--				<input type="submit" value="查询">-->

<!--			</button>-->
<!--        </form>-->
<!--        <button onclick="window.location.href='{{url_for('courseadd')}}'">-->
<!--				<i class="fa fa-plus"></i>-->
<!--				新增-->
<!--			</button>-->
<!--    </div>-->
<!--    <table class="tablelist" id="abcde">-->
<!--        <thead>-->
<!--            <tr>-->
<!--                <th>课程编号</th>-->
<!--                <th>课程名称</th>-->
<!--                <th>上限人数</th>-->
<!--                <th>学分</th>-->
<!--                <th>开始时间</th>-->
<!--                <th>结束时间</th>-->
<!--                <th>上课地点</th>-->
<!--                <th>任课老师</th>-->
<!--                <th>上课时间</th>-->
<!--                <th>允许年级</th>-->
<!--                <th>允许系</th>-->
<!--                <th>已选人数</th>-->
<!--                <th width="120px">操作</th>-->
<!--            </tr>-->
<!--        </thead>-->

<!--        {% for v in cour_info %}-->
<!--        <tr>-->
<!--            <td>{{v[0]}}</td>-->
<!--            <td>{{v[1]}}</td>-->
<!--            <td>{{v[2]}}</td>-->
<!--            <td>{{v[3]}}</td>-->
<!--            <td>{{v[4]}}</td>-->
<!--            <td>{{v[5]}}</td>-->
<!--            <td>{{v[6]}}</td>-->
<!--            <td>{{v[7]}}</td>-->
<!--            <td>{{v[8]}}</td>-->
<!--            <td> {{v[9]}}</td>-->
<!--            <td> {{v[10]}}</td>-->
<!--            <td> {{v[11]}}</td>-->


<!--            <td>-->
<!--                <button class="remove" id="{{v[0]}}" onclick=delcfm(this)>-->
<!--							<i class="fa fa-remove"></i>-->
<!--							删除-->
<!--						</button>-->
<!--            </td>-->
<!--        </tr>-->
<!--        {% endfor %}-->

<!--    </table>-->
<!--    <table class="page">-->
<!--         <td>-->
<!--            <button onclick="first(this) ">首页</button>-->
<!--            <button onclick="prev(this) ">上一页</button>-->
<!--            <button onclick="next(this) ">下一页</button>-->
<!--            <button onclick="last(this) ">尾页</button>-->
<!--            <input type=" text " class="page-no " name="pageNo " value="1" />-->
<!--            <button onclick="change(this) ">转</button>-->
<!--        </td>-->
<!--    </table>-->
<!--</body>-->

<!--</html>-->
<!--<script>-->
<!--        function delcfm(p) {-->
<!--            var r = confirm("确认删除该信息？");-->
<!--            if (r == true) {-->

<!--                var sno = p.parentNode.parentNode.children[0].innerHTML;-->
<!--                var s = parseInt(p.parentNode.parentNode.children[11].innerHTML);-->
<!--                if (s == 0) {-->
<!--                    var xml = new XMLHttpRequest();-->
<!--                    xml.open("get", "http://127.0.0.1:8080/delecour/" + sno, true);-->
<!--                    // xml.onreadystatechange = function () {-->
<!--                    //-->
<!--                    // };-->
<!--                    xml.send();-->
<!--                    // xml.send("callback=functionName");-->
<!--                    alert("删除成功");-->
<!--                    window.location.href = '{{url_for('courselist')}}';-->
<!--                } else alert("不能删除");-->
<!--            } else-->
<!--                alert("信息未删除");-->
<!--        }-->
<!--        var page = 1;-->
<!--         var tabl = document.getElementById("abcde");-->
<!--         alert(tabl);-->
<!--        var maxo = 10;-->
<!--        for (var i = 0; i < (tabl.rows.length - 1); i++) {-->
<!--            tabl.rows[i + 1].style.display = 'none';-->
<!--        }-->

<!--        for (var i = 0; i < maxo; i++)-->
<!--            tabl.rows[i + 1].style.display = "table-row";-->

<!--        function vanish(num) {-->
<!--            var limt = num * maxo;-->
<!--            for (var i = 0; i < (tabl.rows.length - 1); i++) {-->
<!--                tabl.rows[i + 1].style.display = 'none';-->
<!--            }-->

<!--            if (limt > (tabl.rows.length - 1))-->
<!--                limt = (tabl.rows.length - 1);-->
<!--            for (var i = (num - 1) * maxo; i < limt; i++)-->
<!--                tabl.rows[i + 1].style.display = "table-row";-->
<!--        }-->

<!--        function first(id) {-->
<!--            alert(1);-->
<!--            page = 1;-->
<!--            vanish(page);-->
<!--            id.parentNode.children[4].value = page;-->
<!--        }-->

<!--        function last(id) {-->
<!--            var maxsu = 0;-->
<!--            if ((tabl.rows.length - 1) % maxo == 0)-->
<!--                maxsu = Math.floor((tabl.rows.length - 1) / maxo);-->
<!--            else maxsu = Math.floor((tabl.rows.length - 1) / maxo) + 1;-->
<!--            page = maxsu;-->
<!--            vanish(page);-->
<!--            id.parentNode.children[4].value = page;-->
<!--        }-->

<!--        function prev(id) {-->
<!--            if (page > 1)-->
<!--                page&#45;&#45;;-->
<!--            vanish(page);-->
<!--            id.parentNode.children[4].value = page;-->
<!--        }-->

<!--        function next(id) {-->
<!--            var maxsu = 0;-->
<!--            if ((tabl.rows.length - 1) % maxo == 0)-->
<!--                maxsu = Math.floor((tabl.rows.length - 1) / maxo);-->
<!--            else maxsu = Math.floor((tabl.rows.length - 1) / maxo) + 1;-->
<!--            if (page < maxsu)-->
<!--                page++;-->
<!--            id.parentNode.children[4].value = page;-->
<!--            vanish(page);-->
<!--        }-->

<!--        function change(id) {-->
<!--            if ((tabl.rows.length - 1) % maxo == 0)-->
<!--                maxsu = Math.floor((tabl.rows.length - 1) / maxo);-->
<!--            else maxsu = Math.floor((tabl.rows.length - 1) / maxo) + 1;-->
<!--            page = id.parentNode.children[4].value;-->
<!--            if (page > maxsu)-->
<!--                page = maxsu;-->
<!--            if (page < 0)-->
<!--                page = 1;-->
<!--            id.parentNode.children[4].value = page;-->
<!--            vanish(page);-->
<!--        }-->
<!--    </script>-->
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>列表</title>
    <link rel="stylesheet" href="../static/css/styles.css" />
    <link rel="stylesheet" href="../static/css/font-awesome-4.7.0/css/font-awesome.min.css" />
    <script src="../static/js/jquery.min.js" type="text/javascript"></script>
</head>

<body>
    <div class="condition">
        <form action="{{ url_for('courselistse') }}" method="post" enctype="multipart/form-data">
            课程编号<input type="text" name="cid"> 课程名称：
            <input type="text" name="cname">上课时间：
            <input type="text" name="classtime">

            <button>
				<i class="fa fa-search" type="submit"></i>
				<input type="submit" value="查询">

			</button>
        </form>
        <button onclick="window.location.href='{{url_for('courseadd')}}'">
				<i class="fa fa-plus"></i>
				新增
			</button>
    </div>
    <table class="tablelist" id="abcde">
        <thead>
            <tr>
                <th>课程编号</th>
                <th>课程名称</th>
                <th>上限人数</th>
                <th>学分</th>
                <th>开始时间</th>
                <th>结束时间</th>
                <th>上课地点</th>
                <th>任课老师</th>
                <th>上课时间</th>
                <th>允许年级</th>
                <th>允许系</th>
                <th>已选人数</th>
                <th width="120px">操作</th>
            </tr>
        </thead>

        {% for v in cour_info %}
        <tr>
            <td>{{v[0]}}</td>
            <td>{{v[1]}}</td>
            <td>{{v[2]}}</td>
            <td>{{v[3]}}</td>
            <td>{{v[4]}}</td>
            <td>{{v[5]}}</td>
            <td>{{v[6]}}</td>
            <td>{{v[7]}}</td>
            <td>{{v[8]}}</td>
            <td> {{v[9]}}</td>
            <td> {{v[10]}}</td>
            <td> {{v[11]}}</td>


            <td>

                <button class="remove" id="{{v[0]}}" onclick=delcfm(this)>
							<i class="fa fa-remove"></i>
							删除
						</button>
            </td>
        </tr>
        {% endfor %}

    </table>
    <table class="page">
         <td>
            <button onclick="first(this) ">首页</button>
            <button onclick="prev(this) ">上一页</button>
            <button onclick="next(this) ">下一页</button>
            <button onclick="last(this) ">尾页</button>
            <input type=" text " class="page-no " name="pageNo " value="1" />
            <button onclick="change(this) ">转</button>
        </td>
    </table>
<script>
        var page = 1;
         var tabl = document.getElementById("abcde");
        var maxo = 13;
        for (var i = 0; i < (tabl.rows.length - 1); i++) {
            tabl.rows[i + 1].style.display = 'none';
        }

        for (var i = 0; i < maxo; i++)
            tabl.rows[i + 1].style.display = "table-row";

        function vanish(num) {
            var limt = num * maxo;
            for (var i = 0; i < (tabl.rows.length - 1); i++) {
                tabl.rows[i + 1].style.display = 'none';
            }

            if (limt > (tabl.rows.length - 1))
                limt = (tabl.rows.length - 1);
            for (var i = (num - 1) * maxo; i < limt; i++)
                tabl.rows[i + 1].style.display = "table-row";
        }

        function first(id) {
            page = 1;
            vanish(page);
            id.parentNode.children[4].value = page;
        }

        function last(id) {
            var maxsu = 0;
            if ((tabl.rows.length - 1) % maxo == 0)
                maxsu = Math.floor((tabl.rows.length - 1) / maxo);
            else maxsu = Math.floor((tabl.rows.length - 1) / maxo) + 1;
            page = maxsu;
            vanish(page);
            id.parentNode.children[4].value = page;
        }

        function prev(id) {
            if (page > 1)
                page--;
            vanish(page);
            id.parentNode.children[4].value = page;
        }

        function next(id) {
            var maxsu = 0;
            if ((tabl.rows.length - 1) % maxo == 0)
                maxsu = Math.floor((tabl.rows.length - 1) / maxo);
            else maxsu = Math.floor((tabl.rows.length - 1) / maxo) + 1;
            if (page < maxsu)
                page++;
            id.parentNode.children[4].value = page;
            vanish(page);
        }

        function change(id) {
            if ((tabl.rows.length - 1) % maxo == 0)
                maxsu = Math.floor((tabl.rows.length - 1) / maxo);
            else maxsu = Math.floor((tabl.rows.length - 1) / maxo) + 1;
            page = id.parentNode.children[4].value;
            if (page > maxsu)
                page = maxsu;
            if (page < 0)
                page = 1;
            id.parentNode.children[4].value = page;
            vanish(page);
        }
       function delcfm(p) {
            var r = confirm("确认删除该信息？");
            if (r == true) {

                var sno = p.parentNode.parentNode.children[0].innerHTML;
                var s=parseInt(p.parentNode.parentNode.children[11].innerHTML);
                if(s==0){
                var xml = new XMLHttpRequest();
                xml.open("get", "http://127.0.0.1:8080/delecour/" + sno, true);
                // xml.onreadystatechange = function () {
                //
                // };
                xml.send();
                // xml.send("callback=functionName");
                alert("删除成功");
                window.location.href = '{{url_for('courselist')}}';}
                else alert("不能删除");
            } else
                alert("信息未删除");
        }
    </script>
</body>

</html>